SUMMARY

    • We must open a file before any I/O operation can be performed on it.

     

    • Open allocates a buffer for I/O to the file and determines the mode of access to use with the buffer.

     

    • If the file specified by pathname doesn't exist, it is created when a file is opened for Append, Binary, Output, or Random modes.

     

    • If the file is already opened by another process and the specified type of access is not allowed, the Open operation fails and an error occurs.

     

    • The Len clause is ignored if mode is Binary.

     

    • In Binary, Input, and Random modes, you can open a file using a different file number without first closing the file.

     

    • In Append and Output modes, you must close a file before opening it with a different file number.Given the information above, we would not use the optional Len clause when opening a file in binary mode, as it does not apply. In the sample programs to follow, the optional lock entry is not used either.

basic file handling by v. vanthana